﻿
using System;
using System.Collections.Generic;
using System.Text;

using RabbitMQ.Client;
using RabbitMQ.Client.Events;


namespace RabbitMQClientCore
{
    public static class Mq
    {
        public static IConnection GetConnect()
        {
            //建立RabbitMQ连接和通道
            var connectionFactory = new ConnectionFactory
            {
                HostName = "192.168.227.130",
                Port = 5672,
                UserName = "jack",
                Password = "jack",
                AutomaticRecoveryEnabled = true, //自动重连
                RequestedHeartbeat = new TimeSpan(15) //心跳超时时间
            };
            return connectionFactory.CreateConnection();
        }
    }
}
